import pygame
from game import Game


class Bullet:
    def __init__(self, left: int, top: int, direction: str, speed: int):
        self.Bullet_image0 = pygame.image.load("Img/Bullet.png")
        self.Bullet_image = pygame.transform.scale(self.Bullet_image0, (20, 20))
        self.Bullet_rect = self.Bullet_image.get_rect()
        self.Bullet_rect.left = left
        self.Bullet_rect.top = top
        self.Bullet_speed = speed
        self.direction = direction

    def bullet_display(self):
        Game.window.blit(self.Bullet_image, self.Bullet_rect)

    def bullet_fire(self):
        if self.direction == "left":
            self.Bullet_rect.left -= self.Bullet_speed
        elif self.direction == "right":
            self.Bullet_rect.left += self.Bullet_speed
